Sometimes a computational problem can be divided into pieces in a way that allows a system to work on more than one piece at a time. For example, concurrent computing simultaneously carries out multiple computing tasks, such as multiple threads or multiple processes. Similarly, parallel computing systems carry out multiple instructions simultaneously. Parallel computing may be viewed as an example of concurrent computing, and the distinction between them is not critical here.
Various tools and techniques are used to coordinate the pieces of a divided computational problem. For example, locks are sometimes used to control access to shared resources, such as variables which are used by more than one thread of a program. Locks may also be used to provide synchronization between threads.
In place of locks, or in addition to them, transactional memory may be used to control access to shared memory. Transactional memory supports transactions. In some transactional memory systems, code in a transaction executes a series of reads and writes to shared memory which appear, from outside the transaction, to happen atomically. That is, the intermediate states of the shared memory are not visible to other transactions. Either the entire result of all shared variable reads and writes in a transaction are visible outside the transaction (after the transaction succeeded), or else none of that result is visible (the transaction failed).